﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebsiteDataModel;

public partial class morning_zsadd : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            WebsiteDataModel.WebsiteDataEntities de = new WebsiteDataModel.WebsiteDataEntities();
            foreach (WebsiteDataModel.ZS_Title t in de.ZS_Title.ToList())
            {
                ListItem item = new ListItem();
                item.Value = t.id.ToString();
                item.Text = t.title;
                DropDownList1.Items.Add(item);
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        WebsiteDataEntities de = new WebsiteDataEntities();
        ZS_ContentData content = new ZS_ContentData();
        content.BelongsIndex = int.Parse(this.DropDownList1.SelectedValue);
        content.name = TextBox1.Text;
        de.ZS_ContentData.AddObject(content);
        de.SaveChanges();
    }
}